package com.fr.lintcode;

import java.util.ArrayList;
import java.util.List;
import java.util.Stack;

public class Q67 {

    /**
     * @param root: A Tree
     * @return: Inorder in ArrayList which contains node values.
     */
    public List<Integer> inorderTraversal(TreeNode root) {
        // write your code here
    	List<Integer> rs = new ArrayList<>();
    	inorderTraversal(root, rs);
    	return rs;
    }
    private void inorderTraversal(TreeNode node, List<Integer>rs) {
    	if(node == null) {
    		return;
    	}
    	if(node.left != null) {
    		inorderTraversal(node.left, rs);
    	}
    	rs.add(node.val);
    	if(node.right != null) {
    		inorderTraversal(node.right, rs);
    	}
    }

}
